package com.ysj.demo.mvpdemo.ui.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.ysj.demo.mvpdemo.R;
import com.ysj.demo.mvpdemo.bean.Box;
import com.ysj.demo.mvpdemo.bean.User;
import com.ysj.demo.mvpdemo.event.MessageEvent;

import java.util.ArrayList;

import de.greenrobot.event.EventBus;

/**
 * Created by 80530 on 2018/6/12.
 */

public class SecondActivity extends AppCompatActivity {
    private Button bt_message;
    private TextView tv_message;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        Box<String,String,Integer> box = new Box();
        box.setT("hello");
        box.setV(1);

        Toast.makeText(this,box.getT() +"   "+ box.getV(),Toast.LENGTH_SHORT).show();

        tv_message = findViewById(R.id.tv_message);
        tv_message.setText("SecondActivity");
        bt_message = findViewById(R.id.bt_message);
        bt_message.setText("发送事件");
        bt_message.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                EventBus.getDefault().post(new MessageEvent(new User("欢迎关注刘望舒的博客", "123")));
                EventBus.getDefault().post("不同内容返回");
                finish();
            }
        });
    }
}